﻿using AspNetCore.HttpClientAndPolly.PollyHelper;
using System.Net.Http;
using System.Threading.Tasks;

namespace AspNetCore.HttpClientAndPolly.WebApiClients
{
    /// <summary>
    /// TraffLightStockhnApiicApi 后续统一走配置文件
    /// </summary>
    public class LightStockhnApiService : BaseApiService
    {
        private static readonly string _baseUrl = "https://www.cls.cn";

        //2、使用
        private readonly HttpClient _httpClient;
        public LightStockhnApiService(IHttpClientFactory httpClientFactory)
        {
            _httpClient = httpClientFactory.CreateClient();
        }
     
        /// <summary>
        /// 时光基接口
        /// </summary>
        /// <returns></returns>
        public virtual object GetTimeFundList()
        {
            string url = "/v1/roll/get_roll_list?app=CailianpressWeb&category=fund&last_time=1627288420&os=web&refresh_type=1&rn=20&sv=7.5.5&sign=011b30ee1ec3021b27c3c8cfe125ea4a";
            return RequestApiProxy.Get<object>(_httpClient, $"{_baseUrl}{url}");
        }
    }
}
